package com.vr.xuecheng.content.controller;

import cn.hutool.core.lang.tree.Tree;
import com.vr.xuecheng.content.service.ICourseCategoryService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 课程分类 前端控制器
 * </p>
 *
 * @author hzh
 */
@Slf4j
@RestController
@Tag(name = "课程分类")
@RequestMapping("/course-category")
@RequiredArgsConstructor
public class CourseCategoryController {

    private final ICourseCategoryService courseCategoryService;

    /**
     * 获取课程列表以树形结构的方式
     * @return {@link List }<{@link Tree }<{@link String }>>
     */
    @Operation(summary = "获取课程列表以树形结构的方式")
    @GetMapping("/tree-nodes")
    public List<Tree<String>> getCourseCategoryTreeNodes() {
        return courseCategoryService.getCourseCategoryTreeNodes();
    }
}
